﻿<%@ Page Language="C#" %>

<%@ Import Namespace="wojilu" %>
<%@ Import Namespace="wojilu.View" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Domain" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Service" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>#{softtitle}</title>
<link href="#{path.css}ybb/css/baselist.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/all.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/formdiv.css?v=#{cssVersion}" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="#{path.js}ybb/js/jquery.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/form.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/control.js?v=#{jsVersion}"></script>
<script type="text/javascript">

	var resizewindow= null;

	window.onresize = function(){
		var h = $(window).height();
		if(resizewindow!=h){
			sizewindow();
			resizewindow=h;
		}
	}

	function sizewindow(){
		var h = $(window).height();
		if(document.getElementById("mainbodybottonauto")){
			$('.managebottonadd').css({height:h-40});
		}
	}
	var subjectmanage_type_add_mid = "_{subjectmanage_type_add_mid}";
	var subjectmanage_js_noselect_empty = "_{subjectmanage_js_noselect_empty}";
	var subjectmanage_js_subjectname_empty = "_{subjectmanage_js_subjectname_empty}";
	var subjectmanage_js_dirname_empty = "_{subjectmanage_js_dirname_empty}";
	var subjectmanage_js_template_empty = "_{subjectmanage_js_template_empty}";
	var subjectmanage_js_pagemax_empty = "_{subjectmanage_js_pagemax_empty}";
	var subjectmanage_js_type_add_ok = "_{subjectmanage_js_type_add_ok}";
	var subjectmanage_js_type_add_no = "_{subjectmanage_js_type_add_no}";
	var iframename = "#{iframename}";
	iframename = iframename=='' ? "jerichotabiframe_0" : iframename;
	$(document).ready(function(){
	    var h = '#{iframeheightwindow}';
		$('.managebottonadd').css({height:h-40});
		var options = {
			beforeSubmit: formverify,
			success:saveResponse,
			resetForm: true
		}
		$('#subadd').submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
		parent.scrolclear();
	})




	function formverify(formData) {
		var queryString = $.param(formData);
		var get=urlarray(queryString);
		if(get['mid']==0){
			document.subadd.mid.focus();
			alert(subjectmanage_type_add_mid+subjectmanage_js_noselect_empty);
			return false;
		}
		if(get['subjectname']==''){
			document.subadd.subjectname.focus();
			alert(subjectmanage_js_subjectname_empty);
			return false;
		}
		if(get['isdirname']==0) {
			if(get['dirname'].match(/^[\w-]+$/ig)==null) {
				document.subadd.dirname.focus();
				alert(subjectmanage_js_dirname_empty);
				return false;
			}
		}
		if(get['template'].match(/^[\w]+$/ig)==null || get['filenamestyle'].match(/^[\{\}\w-]+$/ig)==null) {
			document.subadd.template.focus();
			alert(subjectmanage_js_template_empty);
			return false;
		}
		if(get['pagemax']!='') {
			if(get['pagemax'].match(/^[0-9]+$/ig)==null) {
				document.subadd.pagemax.focus();
				alert(subjectmanage_js_pagemax_empty);
				return false;
			}
		}
		parent.windowsdig('Loading','iframe:#{load}','400px','180px','iframe',false);
	}
	function saveResponse(options){
		parent.closeifram();
		var tab=document.getElementById("subaddtab").value;
		if (options=='true'){
			if(parent.frames[iframename].document.getElementById("selectform")){
				parent.frames[iframename].refresh('selectform','selectall','check_all');
			}
			alert(subjectmanage_js_type_add_ok);
		}else{
			alert(subjectmanage_js_type_add_no+"("+options+")");
		}
		var refalse = "#{refalse}";
		if (refalse!='1'){
			parent.scrolopen();
			parent.onaletdoc()
		}else{
			window.location.reload();
		}
	}
</script>
</head>

<body>
<form name="subadd" id="subadd" method="post" action="#{ActionLink}">
<input type="hidden" name="lng" id="lng" value="#{lng}" />
<input type="hidden" name="tab" id="subaddtab" value="#{tab}" />
<div id="mainbodybottonauto" class="managebottonadd">
	<div class="maindobycontent">
		<!--查看已选择的类型-->
		<div class="suggestion">
			<span class="sugicon"><span class="strong colorgorning2">_{position_title}</span><span class="colorgorningage">_{subjectmanage_type_add_mess}</span></span>
		</div>
		<div class="manageeditdiv">
			<div class="maneditcontent">
				<table class="formtable">
					<tr class="trstyle2">
						<td width="15%" class="trtitle011">_{subjectmanage_type_add_mid}</td>
						<td width="85%" class="trtitle02">
							<select size="1" name="mid" id="mid">
								<option value="0">_{subjectmanage_type_add_mid_option}</option>
                                <%var modelarray = v.data("modelarray") as List<Model>; %>
                                <%foreach(var row in modelarray){ %>
								<option value="<%=row.Id %>"><%=row.modelname %></option>
								<%} %>
							</select>
							<span class="cautiontitle">_{subjectmanage_type_add_mid_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle011">_{subjectmanage_type_add_subjectname}</td>
						<td width="85%" class="trtitle02">
							<input type="text" name="subjectname" size="60" maxlength="100" class="infoInput"/>
							<span class="cautiontitle">_{subjectmanage_type_add_subjectname_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle011">_{typemanage_type_add_isdirname}</td>
						<td width="85%" class="trtitle02">
							<input type="radio" value="1" name="isdirname" onclick="ondisplay('isdirnamediv','trstyle2 displaynone');sumbiton();" checked="checked"/> _{open_botton_title}&nbsp;
							<input type="radio" value="0" name="isdirname" onclick="ondisplay('isdirnamediv','trstyle2 displaytrue')"/> _{close_botton_title}
							<span class="cautiontitle">_{typemanage_type_add_isdirname_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2 displaynone" id="isdirnamediv">
						<td width="15%" class="trtitle011">_{typemanage_type_add_dirname}</td>
						<td width="85%" class="trtitle02">
							<input type="text" name="dirname" size="20" maxlength="100" class="infoInput" onblur="checktypelngname('dirname',this.value,/^[\w-]+$/ig,'<%=link.to(new wojilu.Web.Controller.Admin.Qycms.SubjectController().CheckDirName) %>','dirnameerr','_{subjectmanage_js_type_dirname_check_ok}','_{subjectmanage_js_type_dirname_check_no}','subaddsubmitbotton');"/>
							<span class="cautiontitle" id="dirnameerr">_{typemanage_type_add_dirname_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{subjectmanage_type_add_subpic}</td>
						<td width="85%" class="trtitle02">
							<ul class="addpiclist">
								<li id="addsrlipic"><a title="_{selectfile_botton}" onclick="javascript:parent.windowsdig('_{filemanage_select_title}','iframe:<%=link.to(new wojilu.Web.Controller.Admin.Qycms.PublicController().FileWindow) %>?listfunction=filelist&filetype=img&checkfrom=picshow&getbyid=addsrlipic&fileinputid=subpic&maxselect=1&iframename='+self.frameElement.getAttribute('name'),'900px','480px','iframe')" href="#body"><p><img id="addsrcpic" src="#{path.img}ybb/images/pic.png"></p></a></li>
							</ul>
							<input type="hidden" name="subpic" id="subpic" size="50" maxlength="50" class="infoInput"/>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{subjectmanage_type_add_content}</td>
						<td width="85%" class="trtitle02"><textarea name="content" cols="50" rows="5" class="smallInput" style="width:98%;height:70px;" ></textarea></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle03" colspan="2">_{article_doc_tab_title01}</td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">_{article_doc_add_headtitle}</td>
						<td class="trtitle02"><input type="text" name="headtitle" id="headtitle" maxlength="100" class="infoInput" style="width:98%;"/></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01"></td>
						<td class="trtitle02">
							<a class="keyselect" href="#body" onclick="javascript:parent.windowsdig('_{selectkeytype_botton}','iframe:<%=link.to(new wojilu.Web.Controller.Admin.Qycms.SEOController().SEOSelect) %>?inputtext=keywords&listfunction=keytype&checkfrom=function&maxselect=1&mid='+document.subadd.mid.value+'&iframename='+self.frameElement.getAttribute('name'),'850px','450px','iframe');">_{selectkeytype_botton}</a>
							<a class="keyselect" href="#body" onclick="javascript:parent.windowsdig('_{selectkeyword_botton}','iframe:<%=link.to(new wojilu.Web.Controller.Admin.Qycms.SEOController().SEOSelect) %>?inputtext=keywords&listfunction=key&checkfrom=input&mid='+document.subadd.mid.value+'&iframename='+self.frameElement.getAttribute('name'),'650px','380px','iframe');">_{selectkeyword_botton}</a>
						</td>
					</tr>
					<tr class="trstyle3">
						<td class="trtitle01">_{article_doc_add_keywords}</td>
						<td class="trtitle02">
							<input type="text" name="keywords" id="keywords" maxlength="100" class="infoInput" style="width:98%;"/>
						</td>
					</tr>
					<tr class="trstyle3">
						<td class="trtitle01">_{article_doc_add_description}</td>
						<td class="trtitle02">
							<textarea name="description" id="description"  style="width:98%;height:50px;" class="smallInput"></textarea>
						</td>
					</tr>

					<tr class="trstyle2">
						<td class="trtitle03" colspan="2">_{typemanage_type_add_templatesurl}</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{subjectmanage_type_add_purview}</td>
						<td width="85%" class="trtitle02">
							<select size="1" name="purview" id="purview">
								<option value="0">_{subjectmanage_type_add_purview_option}</option>
                                <%var memberpuvlist = v.data("memberpuvlist") as List<Member_Class>; %>
                                <%foreach(var row in memberpuvlist){ %>
								<option value="<%=row.Id %>"><%=row.rankname %></option>
								<%} %>
							</select>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{typemanage_type_add_pageclass}</td>
						<td width="85%" class="trtitle02">
							<input type="radio" value="1" name="ishtml" checked="checked" onclick="showdiv(1,'#filenamestylediv','0|1','trstyle2 displaynone|trstyle2 displaytrue',1,0)"/> _{typemanage_type_add_pageclass_1}&nbsp;
							<input type="radio" value="0" name="ishtml" onclick="showdiv(0,'#filenamestylediv','0|1','trstyle2 displaynone|trstyle2 displaytrue',1,0)"/> _{typemanage_type_add_pageclass_0}
							<span class="cautiontitle">_{typemanage_type_add_pageclass_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{subjectmanage_type_add_styleid}</td>
						<td width="85%" class="trtitle02">
							<select size="1" name="styleid" id="styleid" onchange="showdiv(this.value,'#filenamestylediv|#pagemaxdiv','1|2','trstyle2 displaynone|trstyle2 displaytrue',1,1)">
								<option value="2">_{subjectmanage_type_add_styleid_2}</option>
								<option value="1">_{subjectmanage_type_add_styleid_1}</option>
							</select>
						</td>
					</tr>
					<tr class="trstyle2" id="templatediv">
						<td width="15%" class="trtitle01">_{typemanage_type_add_templateindex}</td>
						<td width="85%" class="trtitle02">
							<input type="text" name="indextemplates" id="indextemplates" size="20" maxlength="80" value="#{tempname.subjectindex}" class="infoInput"/>
							<a class="filecheck" href="#body" onclick="javascript:parent.windowsdig('_{selecttempfile_botton}','iframe:<%=link.to(new wojilu.Web.Controller.Admin.Qycms.TemplateController().TemplateMain) %>?inputtext=indextemplates&typeclass=article&skindir=&filedir=article&fileclass=&freshid='+Math.random()+'&iframename='+self.frameElement.getAttribute('name'),'750px','400px','iframe');">_{selecttempfile_botton}</a>
							<span class="cautiontitle">_{typemanage_type_add_template_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{subjectmanage_type_add_template}</td>
						<td width="85%" class="trtitle02">
							<input type="text" id="subtemplatevalue" name="template" size="20" maxlength="80" value="#{tempname.subjectlist}" class="infoInput"/>
							<a class="filecheck" href="#body" onclick="javascript:parent.windowsdig('_{selecttempfile_botton}','iframe:<%=link.to(new wojilu.Web.Controller.Admin.Qycms.TemplateController().TemplateMain) %>?inputtext=subtemplatevalue&typeclass=article&skindir=&filedir=article&fileclass=&freshid='+Math.random()+'&iframename='+self.frameElement.getAttribute('name'),'750px','400px','iframe');">_{selecttempfile_botton}</a>
							<span class="cautiontitle">_{subjectmanage_type_add_template_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2" id="pagemaxdiv">
						<td width="15%" class="trtitle01">_{subjectmanage_type_add_pagemax}</td>
						<td width="85%" class="trtitle02">
							<input type="text" name="pagemax" size="5" maxlength="3" value="0" class="infoInput"/>
							<span class="cautiontitle">_{subjectmanage_type_add_pagemax_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2" id="filenamestylediv">
						<td width="15%" class="trtitle01">_{subjectmanage_type_add_filenamestyle}</td>
						<td width="85%" class="trtitle02">
							<select size="1" name="filenamestyle" id="filenamestyle">
                                <%var filetemplate = v.data("filetemplate") as List<TypeUrl>; %>
								<%foreach(var row in filetemplate){ %>
								<option value="<%=row.Ids %>"><%=row.Name %>.#{file_fileex}</option>
								<%} %>
							</select>
						</td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle03" colspan="2">_{iswap_message}</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{iswap_title}</td>
						<td width="85%" class="trtitle02">
							<input type="radio" value="1" name="iswap" checked="checked"/> _{open_botton_title}&nbsp;
							<input type="radio" value="0" name="iswap"/> _{close_botton_title}
							<span class="cautiontitle">_{iswap_title_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{iswap_templates_file}</td>
						<td width="85%" class="trtitle02">
							<input type="text" id="waptempalte" name="waptempalte" size="30" maxlength="80" value="#{tempname.subjectlist}" class="infoInput"/>
							<a class="filecheck" href="#body" onclick="javascript:parent.windowsdig('_{selecttempfile_botton}','iframe:<%=link.to(new wojilu.Web.Controller.Admin.Qycms.TemplateController().TemplateMain) %>?inputtext=waptempalte&typeclass=article&skindir=wap&filedir=article&fileclass=&freshid='+Math.random()+'&iframename='+self.frameElement.getAttribute('name'),'750px','400px','iframe');">_{selecttempfile_botton}</a>
							<span class="cautiontitle">_{subjectmanage_type_add_template_mess}</span>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</div>
<div id="downbotton">
	<div id="subbotton">
		<table border="0" width="100%">
			<tr>
				<td id="right"><input type="submit" id="subaddsubmitbotton" name="Submit" value="_{botton_add}" class="buttonface" /></td>
				<td id="left" class="padding-left5"><input type="button" name="cancel" onClick="javascript:closewindow();" value="_{botton_add_reset}" class="buttonface" /></td>
			</tr>
		</table>
	</div>
</div>
</form>
</body>

</html>